﻿@using Volo.CmsKit.Public.Web.Pages.CmsKit.Shared.Components.Tags

@model TagViewComponent.TagViewModel

<div class="my-3">
	<div class="cms-tags-area">
		@if (Model.Tags != null)
		{
			<ul class="d-flex flex-wrap gap-1">
				@foreach (var tag in Model.Tags)
				{
					if (Model.UrlFormat.IsNullOrWhiteSpace())
					{
						<li>
							<span class="badge rounded-pill badge-secondary text-bg-secondary cmskit-tag font-weight-normal">
								@tag.Name
							</span>
						</li>
					}
					else
					{
						var formattedUrl = Model.UrlFormat.Replace("{TagId}", tag.Id.ToString()).Replace("{TagName}", tag.Name);
						<li>
							<a href="@formattedUrl"><span class="badge rounded-pill badge-secondary text-bg-secondary cmskit-tag font-weight-normal">@tag.Name</span></a>
						</li>
					}
				}
			</ul>
		}
	</div>
</div> 